﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.SanPhamBinhLuan"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class SanPhamBinhLuanEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the IDSanPhamBinhLuan property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxIDSanPhamBinhLuan;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDSanPhamBinhLuan property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDSanPhamBinhLuanLabel;
		
		/// <summary>
		/// ComboBox for the IDSanPham property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDSanPham;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDSanPham property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDSanPhamLabel;
		
		/// <summary>
		/// TextBox for the TenSuDung property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTenSuDung;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TenSuDung property.
		/// </summary>
		protected System.Windows.Forms.Label uxTenSuDungLabel;
		
		/// <summary>
		/// TextBox for the TenNguoiDung property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTenNguoiDung;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TenNguoiDung property.
		/// </summary>
		protected System.Windows.Forms.Label uxTenNguoiDungLabel;
		
		/// <summary>
		/// TextBox for the Email property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxEmail;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Email property.
		/// </summary>
		protected System.Windows.Forms.Label uxEmailLabel;
		
		/// <summary>
		/// TextBox for the NoiDung property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNoiDung;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the NoiDung property.
		/// </summary>
		protected System.Windows.Forms.Label uxNoiDungLabel;
		
		/// <summary>
		/// DataTimePicker for the ThoiDiemCapNhat property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxThoiDiemCapNhat;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ThoiDiemCapNhat property.
		/// </summary>
		protected System.Windows.Forms.Label uxThoiDiemCapNhatLabel;
		#endregion
		
		#region Main entity
		private Entities.SanPhamBinhLuan _SanPhamBinhLuan;
		/// <summary>
		/// Gets or sets the <see cref="Entities.SanPhamBinhLuan"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.SanPhamBinhLuan"/> instance.</value>
		public Entities.SanPhamBinhLuan SanPhamBinhLuan
		{
			get {return this._SanPhamBinhLuan;}
			set
			{
				this._SanPhamBinhLuan = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxIDSanPhamBinhLuan.DataBindings.Clear();
			this.uxIDSanPhamBinhLuan.DataBindings.Add("Text", this.uxBindingSource, "IDSanPhamBinhLuan", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDSanPham.DataBindings.Clear();
			this.uxIDSanPham.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDSanPham", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTenSuDung.DataBindings.Clear();
			this.uxTenSuDung.DataBindings.Add("Text", this.uxBindingSource, "TenSuDung", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTenNguoiDung.DataBindings.Clear();
			this.uxTenNguoiDung.DataBindings.Add("Text", this.uxBindingSource, "TenNguoiDung", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxEmail.DataBindings.Clear();
			this.uxEmail.DataBindings.Add("Text", this.uxBindingSource, "Email", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNoiDung.DataBindings.Clear();
			this.uxNoiDung.DataBindings.Add("Text", this.uxBindingSource, "NoiDung", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxThoiDiemCapNhat.DataBindings.Clear();
			this.uxThoiDiemCapNhat.DataBindings.Add("Value", this.uxBindingSource, "ThoiDiemCapNhat", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="SanPhamBinhLuanEditControlBase"/> class.
		/// </summary>
		public SanPhamBinhLuanEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_SanPhamBinhLuan != null) _SanPhamBinhLuan.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxIDSanPhamBinhLuan = new System.Windows.Forms.TextBox();
			uxIDSanPhamBinhLuanLabel = new System.Windows.Forms.Label();
			this.uxIDSanPham = new System.Windows.Forms.ComboBox();
			uxIDSanPhamLabel = new System.Windows.Forms.Label();
			this.uxTenSuDung = new System.Windows.Forms.TextBox();
			uxTenSuDungLabel = new System.Windows.Forms.Label();
			this.uxTenNguoiDung = new System.Windows.Forms.TextBox();
			uxTenNguoiDungLabel = new System.Windows.Forms.Label();
			this.uxEmail = new System.Windows.Forms.TextBox();
			uxEmailLabel = new System.Windows.Forms.Label();
			this.uxNoiDung = new System.Windows.Forms.TextBox();
			uxNoiDungLabel = new System.Windows.Forms.Label();
			this.uxThoiDiemCapNhat = new System.Windows.Forms.DateTimePicker();
			uxThoiDiemCapNhatLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDSanPhamBinhLuanLabel
			//
			this.uxIDSanPhamBinhLuanLabel.Text = "IDSanPhamBinhLuan:";
			this.uxIDSanPhamBinhLuanLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDSanPhamBinhLuanLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDSanPhamBinhLuanLabel);			
			//
			// uxIDSanPhamBinhLuan
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDSanPhamBinhLuan);
			this.uxIDSanPhamBinhLuan.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxIDSanPhamBinhLuan);
			//
			// uxIDSanPhamLabel
			//
			this.uxIDSanPhamLabel.Text = "IDSanPham:";
			this.uxIDSanPhamLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxIDSanPhamLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDSanPhamLabel);			
			//
			// uxIDSanPham
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDSanPham);
			this.uxIDSanPham.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxIDSanPham);
			//
			// uxTenSuDungLabel
			//
			this.uxTenSuDungLabel.Text = "TenSuDung:";
			this.uxTenSuDungLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxTenSuDungLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenSuDungLabel);			
			//
			// uxTenSuDung
			//
			this.uxTenSuDung.Width = 250;
			this.uxTenSuDung.MaxLength = 25;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenSuDung);
			this.uxTenSuDung.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxTenSuDung);
			//
			// uxTenNguoiDungLabel
			//
			this.uxTenNguoiDungLabel.Text = "TenNguoiDung:";
			this.uxTenNguoiDungLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxTenNguoiDungLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenNguoiDungLabel);			
			//
			// uxTenNguoiDung
			//
			this.uxTenNguoiDung.Width = 250;
			this.uxTenNguoiDung.MaxLength = 255;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTenNguoiDung);
			this.uxTenNguoiDung.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxTenNguoiDung);
			//
			// uxEmailLabel
			//
			this.uxEmailLabel.Text = "Email:";
			this.uxEmailLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxEmailLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxEmailLabel);			
			//
			// uxEmail
			//
			this.uxEmail.Width = 250;
			this.uxEmail.MaxLength = 255;
			//this.uxTableLayoutPanel.Controls.Add(this.uxEmail);
			this.uxEmail.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxEmail);
			//
			// uxNoiDungLabel
			//
			this.uxNoiDungLabel.Text = "NoiDung:";
			this.uxNoiDungLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxNoiDungLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNoiDungLabel);			
			//
			// uxNoiDung
			//
			this.uxNoiDung.Width = 250;
			this.uxNoiDung.MaxLength = 3000;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNoiDung);
			this.uxNoiDung.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxNoiDung);
			//
			// uxThoiDiemCapNhatLabel
			//
			this.uxThoiDiemCapNhatLabel.Text = "ThoiDiemCapNhat:";
			this.uxThoiDiemCapNhatLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxThoiDiemCapNhatLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxThoiDiemCapNhatLabel);			
			//
			// uxThoiDiemCapNhat
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxThoiDiemCapNhat);
			this.uxThoiDiemCapNhat.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxThoiDiemCapNhat);
			//
			// uxIDSanPham
			//				
			this.uxIDSanPham.DisplayMember = "IDSanPhamDanhMuc";	
			this.uxIDSanPham.ValueMember = "IDSanPham";	
			// 
			// SanPhamBinhLuanEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "SanPhamBinhLuanEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.SanPham> _IDSanPhamList;
		
		/// <summary>
		/// The ComboBox associated with the IDSanPham property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.SanPham> IDSanPhamList
		{
			get {return _IDSanPhamList;}
			set 
			{
				this._IDSanPhamList = value;
				this.uxIDSanPham.DataSource = null;
				this.uxIDSanPham.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDSanPhamList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDSanPham property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDSanPhamList
		{
			get { return _allowNewItemInIDSanPhamList;}
			set
			{
				this._allowNewItemInIDSanPhamList = value;
				this.uxIDSanPham.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
